package com.itheima.loginMapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: yg
 * @create 2025-02-07 - 18:52
 * @
 */
public interface UserMapper {
    /*
     * 该方法用于用户登录校验的
     **/
    @Select("select * from tb_user where username = #{username} and password = #{password}")
    User selectByUser(@Param("username") String username, @Param("password") String password);
    /*
     * 该方法用于注册判断用户名是否一致
     **/
    @Select("select * from tb_user where username = #{username}")
    User selectByUsername(@Param("username") String username);
    /*
     * 该方法用于添加用户
     **/
    @Insert("insert into tb_user values(null, #{username}, #{password})")
    void addUser(User user);
}
